﻿using MediatR;
using Swork03_28.Api.Application.Commands.TraceableCommand;
using Swork03_28.Domain.TraceableInfos;
using Swork03_28.Services.Interface;

namespace Swork03_28.Api.Application.CommandHandlers.TraceableHandler
{
    public class GoodsSelectHandler : IRequestHandler<GoodsSelectCommand, List<GoodsInfo>>
    {
        private readonly IGoodsService goodsService;

        public GoodsSelectHandler(IGoodsService goodsService)
        {
            this.goodsService = goodsService;
        }


        public async Task<List<GoodsInfo>> Handle(GoodsSelectCommand request, CancellationToken cancellationToken)
        {
            return await goodsService.AllAsync();
        }
    }
}
